<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{$store_title}</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js" type="text/javascript"></script>
    <link rel="stylesheet" href="/public/mobile/css/common.css">
    <link rel="stylesheet" href="/public/mobile/css/index.css">
</head>
<body class="login">
    <div class="logo_box">
        <img src="/public/mobile/img/logo.png" class="logo" alt="">
    </div>
    <div class="login_box">
        <ul class="login_form">
            <li class="text">
                <img src="/public/mobile/img/login_text.png" alt="">
            </li>
            <li><label>姓名</label><input type="text" class="user" name="user" placeholder="请输入姓名"></li>
            <li><label>ID</label><input type="text" class="card" name="card" placeholder="请输入身份证后六位"></li>
        </ul>
        <div class="btn_group">
            <img src="/public/mobile/img/activity.png" class="btn" id="rule" alt="">
            <img src="/public/mobile/img/go_game.png" class="btn" id="game" alt="">
        </div>
    </div>
    <div class="login_rule ">
        <img src="/public/mobile/img/icon_x.png" class="icon_x" alt="close" id="close">
        <img src="/public/mobile/img/rule_box1.png" class="rule" alt="rule">
    </div>
<script src="/public/mobile/js/jquery.min.js"></script>
<script src="/public/mobile/js/public.js"></script>
<script>
$().ready(function () {
    var u = navigator.userAgent;
    var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    function fixedInputBlur () {
        setInterval(function () {
            document.querySelector('body').scrollTop = 0;
        },300)
    }
    if(isiOS){
        fixedInputBlur()
    }
    //if(isiOS){
        document.body.addEventListener('touchmove', function (e) {
            e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)
        }, {passive: false});
    //}
    //计算css使用vh的值
    var width=document.body.clientWidth;
    var height=document.body.clientHeight;
    var padtop=parseInt(height*0.1);
    $("body").css("height",height)
    $(".logo_box").css("paddingTop",padtop)
    if(height/width>=1.70){
        $("body").css("backgroundImage","url('/public/mobile/img/login_bgx.jpg')");
        $(".logo").css("opacity",0);
    }
    //显示活动规则
    $("#rule").on("click",function () {
        $(".login_rule").removeClass("hide");
    })
    //关闭弹窗
    $("#close").on("click",function () {
        $(".login_rule").addClass("hide")
    })
    //开始游戏
    $("#game").on("click",function () {
        var user=$(".user").val();
        var card=$(".card").val();
        var regCard=/^[0-9]{6}|([0-9]{5}[Xx])$/
        if(!user){
            alert("请输入姓名");
            return true;
        }
        if(!card){
            alert("请输入身份证后六位");
            return true;
        }else if(!regCard.test(card)){
            alert("请输入正确的身份证号码");
            return true;
        }
        $.post("/index.php/Api/api/do_login",{username:user,password:card},function (res) {
            console.log("do login",res)
            var r = JSON.parse(res)
            if(r.code==200){
                location.href="/mobile/index/game.html"
            }else{
                alert(r.message)
            }
        })
    })
})

</script>
    <script>
        // 微信配置
        wx.config({
            debug: false,
            appId: "{$signPackage['appId']}",
            timestamp: '{$signPackage["timestamp"]}',
            nonceStr: '{$signPackage["nonceStr"]}',
            signature: '{$signPackage["signature"]}',
            jsApiList: [
                'checkJsApi',
                'onMenuShareTimeline',
                'onMenuShareAppMessage',
                'onMenuShareQQ',
                'onMenuShareQZone']
            // 功能列表，我们要使用JS-SDK的什么功能
        });

        //  var ShareLink = "http://{$_SERVER['HTTP_HOST']}"; //默认分享链接
        var ShareLink = "{$data_share['link']}"; //默认分享链接
        var ShareImgUrl ="{$data_share['imgUrl']}"; // 分享图标
        // config信息验证后会执行ready方法，所有接口调用都必须在config接口获得结果之后，config是一个客户端的异步操作，所以如果需要在 页面加载时就调用相关接口，则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口，则可以直接调用，不需要放在ready 函数中。
        wx.ready(function(){
            // 获取"分享到朋友圈"按钮点击状态及自定义分享内容接口
            wx.onMenuShareTimeline({
                title: " {$data_share['title']}", // 分享标题
                link:ShareLink,
                imgUrl:ShareImgUrl ,// 分享图标
                success: function () {

                },
                cancel: function () {

                }
            });

            // 获取"分享给朋友"按钮点击状态及自定义分享内容接口
            wx.onMenuShareAppMessage({
                title: "{$data_share['title']}", // 分享标题
                desc: "{$data_share['desc']}", // 分享描述
                link:ShareLink,
                imgUrl:ShareImgUrl ,// 分享图标
                success: function () {

                },
                cancel: function () {

                    // 用户取消分享后执行的回调函数
                }
            });
            // 分享到QQ
            wx.onMenuShareQQ({
                title: "{$data_share['title']}", // 分享标题
                desc: "{$data_share['desc']}", // 分享描述
                link:ShareLink,
                imgUrl:ShareImgUrl ,// 分享图标
                success: function () {

                },
                cancel: function () {

                }
            });
            // 分享到QQ空间
            wx.onMenuShareQZone({
                title: "{$data_share['title']}", // 分享标题
                desc: "{$data_share['desc']}", // 分享描述
                link:ShareLink,
                imgUrl:ShareImgUrl ,// 分享图标
                success: function () {

                },
                cancel: function () {

                }
            });
        });
    </script>
    <script>
        var _mtac = {};
        (function() {
            var mta = document.createElement("script");
            mta.src = "//pingjs.qq.com/h5/stats.js?v2.0.4";
            mta.setAttribute("name", "MTAH5");
            mta.setAttribute("sid", "500690473");
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(mta, s);
        })();
    </script>
</body>
</html>